const formatNumber = (
	num,
	decimal = 2
) => {
	num = num.toString()
	const index = num.indexOf('.')
	if (index !== -1) {
		num = num.substring(0, decimal + index + 1)
	} else {
		num = num.substring(0)
	}
	//截取后保留两位小数
	return parseFloat(num).toFixed(decimal)
}
export default formatNumber